
<!--防错分析、梳理、策划的表-->
<template>
  <div>
    <!--表头的筛选功能-->
    <div style="text-align: right;margin-bottom: 5px">
      <el-button type="primary" plain size="small" style="margin-right: 8px" @click="filterShow">筛选</el-button>
      <el-button type="primary" plain size="small" @click="editTableShow(1,null)">新增</el-button>
    </div>
    <!-- 带边框的表格 -->
    <div>
      <el-table
          :data="tableData"
          ref="tableRef"
          row-key="id"
          :expand-row-keys="expandedKeys"
          border
          style="width: 100%;"
          header-cell-class-name="table-header"
          cell-class-name="table-cell"
          height="65vh"
      >
        <el-table-column type="expand" v-slot:default="scope">
          <div style="margin-bottom: 5px;border: 1px solid #ccc;" >
            <strong style="color: red">失效描述：</strong>
            <div style="margin-top: 5px">
              <span v-if="scope.row.failure_description==='' ||scope.row.failure_description===null || scope.row.failure_description===undefined"></span>
              <span v-else-if="languageS==='chinese'" v-html="scope.row.failure_description.zh"></span>
              <span v-else-if="languageS==='english'" v-html="scope.row.failure_description.en"></span>
              <span v-else-if="languageS==='russian'" v-html="scope.row.failure_description.ru"></span>
            </div>
          </div>
          <div style="margin-bottom: 5px;border: 1px solid #ccc;">
            <strong style="color: red">防错说明：</strong>
            <span v-if="scope.row.poka_yoke_process_description==='' ||scope.row.poka_yoke_process_description===null || scope.row.poka_yoke_process_description===undefined"></span>
            <span v-else-if="languageS==='chinese'" v-html="scope.row.poka_yoke_process_description.zh"></span>
            <span v-else-if="languageS==='english'" v-html="scope.row.poka_yoke_process_description.en"></span>
            <span v-else-if="languageS==='russian'" v-html="scope.row.poka_yoke_process_description.ru"></span>
          </div>
          <div style="display: flex; gap: 5px; width: 100%; overflow: hidden;;text-align: center"> <!-- 新增overflow控制 -->
            <!-- 左侧容器 -->
            <div style="border: 1px solid #ccc; height: 300px; flex: 1; display: flex; flex-direction: column;text-align: center">
              <!-- 限制表格最大宽度并启用滚动 -->
              <div style="overflow-x: auto; flex: 1;text-align: center;padding-left: 10px">
                <el-table
                    :data="scope.row.related_company_description"
                    border
                    style="width: 97%;"
                    height="290px">
                  <!-- 列宽使用百分比分配 -->
                  <el-table-column prop="id" label="序号" width="50px"></el-table-column>
                  <el-table-column prop="chineseName" label="公司名称" width="80px" v-slot:default="scope">
                    <span v-if="languageS==='chinese'" >{{scope.row.chineseName}}</span>
                    <span v-if="languageS==='english'" >{{scope.row.englishName}}</span>
                    <span v-if="languageS==='russian'" >{{scope.row.russianName}}</span>
                  </el-table-column>
                  <el-table-column prop="info" label="防错说明" v-slot:default="scope">
                    <span v-if="languageS==='chinese'" >{{scope.row.info.zh}}</span>
                    <span v-if="languageS==='english'" >{{scope.row.info.en}}</span>
                    <span v-if="languageS==='russian'" >{{scope.row.info.ru}}</span>
                  </el-table-column>
                  <el-table-column label="编辑" width="50px">
                    <el-link style="margin-right: 5px;margin-left: 5px" @click="edit_related_company_description_show(2,scope)"><i class="el-icon-edit"></i></el-link>
                  </el-table-column>
                </el-table>
              </div>
            </div>

            <!-- 右侧容器 -->
            <div style="border: 1px solid #ccc; height: 300px; flex: 1; min-width: 0;">
              <!-- 限制表格最大宽度并启用滚动 -->
              <div style="overflow-x: auto; flex: 1;text-align: center;padding-left: 10px">
                <el-table
                    :data="scope.row.benchmark_description"
                    border
                    style="width: 97%;"
                    height="290px">
                  <!-- 列宽使用百分比分配 -->
                  <el-table-column prop="id" label="序号" width="50px"></el-table-column>
                  <el-table-column prop="info" label="标杆说明" v-slot:default="scope">
                    <span v-if="languageS==='chinese'" >{{scope.row.info.zh}}</span>
                    <span v-if="languageS==='english'" >{{scope.row.info.en}}</span>
                    <span v-if="languageS==='russian'" >{{scope.row.info.ru}}</span>
                  </el-table-column>
                  <el-table-column label="编辑" width="50px">
                    <el-link style="margin-right: 5px;margin-left: 5px" @click="edit_benchmark_description_show(2,scope)"><i class="el-icon-edit"></i></el-link>
                  </el-table-column>
                </el-table>
              </div>
            </div>
          </div>
        </el-table-column>
        <el-table-column label="序号" v-slot:default="scope" width="50px">
          <div>{{scope.$index}}</div>
        </el-table-column>
        <!-- 零部件信息列组 -->
        <el-table-column prop="part_name" label="零部件名称" width="150px"
          v-slot:default="scope">
          <div>
            <span v-if="scope.row.part_name==='' ||scope.row.part_name===null || scope.row.part_name===undefined"></span>
            <span v-else-if="scope.row.part_name.split('/').length<3">{{scope.row.part_name}}</span>
            <span v-else-if="languageS==='chinese'">{{scope.row.part_name.split('/')[0]}}</span>
            <span v-else-if="languageS==='english'">{{scope.row.part_name.split('/')[1]}}</span>
            <span v-else-if="languageS==='russian'">{{scope.row.part_name.split('/')[2]}}</span>
          </div>
        </el-table-column>
        <el-table-column prop="part_number" label="零部件图号" width="150"></el-table-column>
        <el-table-column prop="engine_model" label="机型"  width="100" v-slot:default="scope">
          <span v-for="(item, index) in scope.row.engine_model" :key="index">
            <span v-if="index!==0" style="margin-left: 1px;margin-right: 1px">/</span>
            <span>{{item}}</span>
          </span>
        </el-table-column>
        <el-table-column label="失效描述" v-slot:default="scope" >
          <div>
            <span v-if="scope.row.failure_description==='' ||scope.row.failure_description===null || scope.row.failure_description===undefined"></span>
            <span v-else-if="languageS==='chinese'" v-html="scope.row.failure_description.zh"></span>
            <span v-else-if="languageS==='english'" v-html="scope.row.failure_description.en"></span>
            <span v-else-if="languageS==='russian'" v-html="scope.row.failure_description.ru"></span>
          </div>
        </el-table-column>
        <!-- 失效分类列组 -->
        <el-table-column prop="failure_classification" label="失效分类"  width="100" v-slot:default="scope">
          <div>
            <span v-if="scope.row.failure_classification==='' ||scope.row.failure_classification===null || scope.row.failure_classification===undefined"></span>
            <span v-else-if="scope.row.failure_classification.split('/').length<3" v-html="scope.row.failure_classification"></span>
            <span v-else-if="languageS==='chinese'" >{{scope.row.failure_classification.split('/')[0]}}</span>
            <span v-else-if="languageS==='english'" >{{scope.row.failure_classification.split('/')[1]}}</span>
            <span v-else-if="languageS==='russian'" >{{scope.row.failure_classification.split('/')[2]}}</span>
          </div>
        </el-table-column>
        <el-table-column prop="poka_yoke_level" label="防错等级"  width="100" v-slot:default="scope">
          <div>
            <span v-if="scope.row.poka_yoke_level==='' ||scope.row.poka_yoke_level===null || scope.row.poka_yoke_level===undefined"></span>
            <span v-else-if="scope.row.poka_yoke_level.split('/').length<3" v-html="scope.row.poka_yoke_level"></span>
            <span v-else-if="languageS==='chinese'" >{{scope.row.poka_yoke_level.split('/')[0]}}</span>
            <span v-else-if="languageS==='english'" >{{scope.row.poka_yoke_level.split('/')[1]}}</span>
            <span v-else-if="languageS==='russian'" >{{scope.row.poka_yoke_level.split('/')[2]}}</span>
          </div>
        </el-table-column>
        <el-table-column prop="poka_yoke_type" label="防错类别"  width="100" v-slot:default="scope">
          <div>
            <span v-if="scope.row.poka_yoke_type==='' ||scope.row.poka_yoke_type===null || scope.row.poka_yoke_type===undefined"></span>
            <span v-else-if="scope.row.poka_yoke_level.split('/').length<3" v-html="scope.row.poka_yoke_type"></span>
            <span v-else-if="languageS==='chinese'" >{{scope.row.poka_yoke_type.split('/')[0]}}</span>
            <span v-else-if="languageS==='english'" >{{scope.row.poka_yoke_type.split('/')[1]}}</span>
            <span v-else-if="languageS==='russian'" >{{scope.row.poka_yoke_type.split('/')[2]}}</span>
          </div>
        </el-table-column>

        <!-- 详细描述列组 -->
        <el-table-column prop="is_implement_poka_yoke" label="是否防错" width="100">
        </el-table-column>

        <el-table-column label="编辑" v-slot:default="scope" width="70px">
          <el-link style="margin-left: 5px" @click="editTableShow(2,scope)"><i class="el-icon-edit"></i></el-link>
          <el-popconfirm
              confirm-button-text="YES"
              cancel-button-text="NO"
              icon="el-icon-info"
              icon-color="red"
              title="确定删除吗？"
              @confirm="editTableOk('delete',scope)">
            <el-link style="margin-left: 5px" slot="reference">
              <i class="el-icon-delete"></i>
            </el-link>
          </el-popconfirm>

        </el-table-column>
      </el-table>
    </div>
    <div style="margin-top: 5px;text-align: center">
      <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page.sync="page.currentPage"
          :page-size="page.pageSize"
          :page-sizes="page.pageSizes"
          layout="total,sizes, prev, pager, next"
          :total="page.total">
      </el-pagination>
    </div>

    <!--弹窗放置区-->
    <!--编辑一条防错分析数据-->
    <el-dialog
        :title="titleUse"
        v-if="table_edit_dialog"
        :visible.sync="table_edit_dialog"
        width="680px"
        :before-close="handleClose"
        append-to-body
        center>
      <div>
        <el-form :model="tableForm" label-width="100px">
          <!-- 零部件信息（选择器） -->
          <el-form-item label="零部件名称">
            <el-select filterable v-model="tableForm.part_name" placeholder="请选择" clearable style="width: 100%">
              <el-option
                  v-for="item in part_option"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="车间名称">
            <el-select filterable v-model="tableForm.workshop" placeholder="请选择" style="width: 100%" disabled clearable>
              <el-option
                  v-for="item in workshop_option"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>

            </el-select >
          </el-form-item>
          <el-form-item  label="线体名称">
            <el-select filterable v-model="tableForm.lineName" placeholder="请选择" style="width: 100%" clearable>
              <el-option
                  v-for="item in line_option"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="工序号">
            <el-select filterable v-model="tableForm.op" placeholder="请选择" style="width: 100%" clearable>
              <el-option
                  v-for="item in op_option"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <!-- 详细描述 -->
          <el-form-item label="失效描述">
            <text-translate
            :language-s="languageS"
            :rich-text-translate-data="tableForm.failure_description"
            @content-change="failure_description_data"></text-translate>
          </el-form-item>

          <el-form-item label="防错描述">
            <rich-text-translate
            :rich-text-translate-data="tableForm.poka_yoke_process_description"
            :language-s="languageS"
            @content-change="poka_yoke_process_description_data"></rich-text-translate>
          </el-form-item>
          <!-- 失效分类 -->
          <el-form-item label="失效分类">
            <el-select filterable v-model="tableForm.failure_classification" placeholder="请选择" style="width: 100%" clearable>
              <el-option
                  v-for="item in failure_classification_option"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>

            </el-select>
          </el-form-item>

          <el-row>
            <el-col :span="12">
              <el-form-item label="防错等级">
                <el-select filterable v-model="tableForm.poka_yoke_level" placeholder="请选择" clearable>
                  <el-option
                      v-for="item in poka_yoke_level_option"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="防错类别">
                <el-select filterable v-model="tableForm.poka_yoke_type" placeholder="请选择" clearable>
                  <el-option
                      v-for="item in poka_yoke_type_option"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>

          <el-row>
            <el-col :span="12">
              <el-form-item label="机型">
                <el-select filterable v-model="tableForm.engine_model" multiple placeholder="请选择" style="width: 100%" clearable>
                  <el-option
                      v-for="item in engine_type_option"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="是否实现">
                <el-select filterable v-model="tableForm.is_implement_poka_yoke" placeholder="请选择" clearable>
                  <el-option
                      v-for="item in is_finish_option"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-form-item>
            <div style="text-align: right">
              <el-button @click="table_edit_dialog=false">取消</el-button>
              <el-button type="primary" @click="editTableOk(null,null)">提交</el-button>
            </div>
          </el-form-item>
        </el-form>
      </div>
    </el-dialog>
    <!--编辑一个兄弟单位的防错数据-->
    <el-dialog
        :title="titleUse"
        v-if="related_company_description_dialog"
        :visible.sync="related_company_description_dialog"
        width="680px"
        :before-close="handleClose"
        append-to-body
        center>
      <div>
        <el-form
            :model="tableForm"
            ref="formRef"
            label-width="120px"
            label-position="left">
          <div v-for="(item, index) in tableForm.related_company_description" :key="index">
            <!-- 中文名称 -->
            <el-form-item :label="item.chineseName">
              <text-translate
              :language-s="languageS"
              :rich-text-translate-data="item.info"
              @content-change="(val) => related_company_translate_data(val, index)"
              ></text-translate>
            </el-form-item>
          </div>
          <el-form-item>
            <div style="text-align: right">
              <el-button @click="related_company_description_dialog=false">取消</el-button>
              <el-button type="primary" @click="edit_related_company_description">提交</el-button>
            </div>
          </el-form-item>
        </el-form>
      </div>
    </el-dialog>

    <!--编辑一个兄弟单位的防错数据-->
    <el-dialog
        :title="titleUse"
        v-if="benchmark_description_dialog"
        :visible.sync="benchmark_description_dialog"
        width="680px"
        :before-close="handleClose"
        append-to-body
        center>
      <div>
        <el-form
            :model="tableForm"
            ref="formRef"
            label-width="120px"
            label-position="left">
          <div v-for="(item, index) in tableForm.benchmark_description" :key="index">
            <!-- 中文名称 -->
            <el-form-item :label="item.chineseName">
              <text-translate
                  :language-s="languageS"
                  :rich-text-translate-data="item.info"
                  @content-change="(val) => benchmark_translate_data(val, index)"
              ></text-translate>
            </el-form-item>
          </div>
          <el-form-item>
            <div style="text-align: right">
              <el-button @click="benchmark_description_dialog=false">取消</el-button>
              <el-button type="primary" @click="edit_related_company_description">提交</el-button>
            </div>
          </el-form-item>
        </el-form>
      </div>
    </el-dialog>

    <!--筛选弹窗-->
    <el-dialog
        :title="titleUse"
        v-if="filter_dialog"
        :visible.sync="filter_dialog"
        width="680px"
        :before-close="handleClose"
        append-to-body
        center>
      <div>
        <el-form :model="filter" label-width="100px">
          <!-- 零部件信息（选择器） -->
          <el-form-item label="零部件名称">
            <el-select filterable v-model="filter.part_name" placeholder="请选择" clearable style="width: 100%">
              <el-option
                  v-for="item in part_option"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="车间名称">
            <el-select filterable v-model="filter.workshop" placeholder="请选择" style="width: 100%"  clearable>
              <el-option
                  v-for="item in workshop_option"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select >
          </el-form-item>
          <el-form-item  label="线体名称">
            <el-select filterable v-model="filter.lineName" placeholder="请选择" style="width: 100%" clearable>
              <el-option
                  v-for="item in line_option"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="工序号">
            <el-select filterable v-model="tableForm.op" placeholder="请选择" style="width: 100%" clearable>
              <el-option
                  v-for="item in op_option"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <!-- 失效分类 -->
          <el-form-item label="失效分类">
            <el-select filterable v-model="filter.failure_classification" placeholder="请选择" style="width: 100%" clearable>
              <el-option
                  v-for="item in failure_classification_option"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          <el-row>
            <el-col :span="12">
              <el-form-item label="防错等级">
                <el-select filterable v-model="filter.poka_yoke_level" placeholder="请选择" clearable>
                  <el-option
                      v-for="item in poka_yoke_level_option"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="防错类别">
                <el-select filterable v-model="filter.poka_yoke_type" placeholder="请选择" clearable>
                  <el-option
                      v-for="item in poka_yoke_type_option"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="12">
              <el-form-item label="机型">
                <el-select filterable v-model="filter.engine_model" multiple placeholder="请选择" style="width: 100%" clearable>
                  <el-option
                      v-for="item in engine_type_option"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="是否实现">
                <el-select filterable v-model="filter.is_finish" placeholder="请选择" clearable>
                  <el-option
                      v-for="item in is_finish_option"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-form-item>
            <div style="text-align: right">
              <el-button @click="filter_dialog=false">取消</el-button>
              <el-button type="primary" @click="filterOk">提交</el-button>
            </div>
          </el-form-item>
        </el-form>
      </div>
    </el-dialog>
  </div>
</template>
<script>

import TextTranslate from "@/components/utils/textTranslate.vue";
import RichTextTranslate from "@/components/utils/richTextTranslate.vue";
import {generateUUIDv4, inquiryProductListBaseComponentAll} from "@/components/utils/useUtils";
import _ from "lodash";

export default {
  name: 'jobDescriptionPokaYokeIdentify',
  components: {RichTextTranslate, TextTranslate},
  props:{
    // 正确写法：指定 type
    languageS: {
      type: String,  // 必须是构造函数
      default: 'chinese'    // 默认值可选
    },
    useName: {
      type: String,  // 必须是构造函数
      default: ''    // 默认值可选
    },
    useId: {
      type: String,  // 必须是构造函数
      default: ''    // 默认值可选
    },
  },
  data() {
    return {
      //展开表格的数据：
      expandedKeys: [],  // 存储需要展开的行key
      // 模拟表格数据（实际项目中通过API获取）
      tableData: [
        {
        // 基础信息
        id: '',             // id
        create_time: null,  // 创建时间
        update_time: null,  // 更新时间
        creator: '',        // 创建人

        // 流程状态
        process_status: '', // 流程状态
        sys_update_user: '', // 更新人
        sys_audit_user: '', // 审核人
        sys_audit_time: null, // 审核时间
        sys_deleted: 0,     // 逻辑删除(0-正常,1-删除)

        // 零部件信息
        part_name: '',      // 零部件名称
        part_number: '',    // 零部件图号
        engine_model: [],   // 机型
        workshop:'',        //车间名称
        lineName:'',        //线体名称
        op:'',              //工序号

        // 失效分类
        failure_classification: '', // 失效分类
        poka_yoke_level: '',        // 防错等级
        poka_yoke_type: '',         // 防错类别
        failure_type: '',           // 失效类别

        // 详细描述
          failure_description: {zh:'',en:'',ru:''},    // 失效描述，文本框编辑
          poka_yoke_process_description: {zh:'',en:'',ru:''}, //防错描述 ，文本框编辑
          is_implement_poka_yoke: '', // 是否实现防错(yes/no)，选择器编辑

          // 对比参考
          related_company_description:[
            {id:1, chineseName:'定兴', englishName:'DingXing', russianName:'DingXing', info:''},
            {id:2, chineseName:'扬中', englishName:'YangZhong', russianName:'YangZhong', info:''},
            {id:3, chineseName:'徐水', englishName:'XuShui', russianName:'XuShui', info:''},
            {id:4, chineseName:'天津', englishName:'TianJing', russianName:'TianJing', info:''},
            {id:5, chineseName:'重庆', englishName:'ChongQing', russianName:'ChongQing', info:''},
            {id:6, chineseName:'江西', englishName:'JiangXi', russianName:'JiangXi', info:''},
            {id:7, chineseName:'大冶', englishName:'DaYan', russianName:'DaYan', info:''},
            {id:8, chineseName:'泰国', englishName:'Thailand', russianName:'Thailand', info:''}
          ], // 兄弟公司描述，文本框编辑
          benchmark_description: [
            {id:1, chineseName:'标杆1',english:'benchmark1',russian:'benchmark1', info:''},
            {id:2, chineseName:'标杆2',english:'benchmark2',russian:'benchmark2', info:''},
            {id:3, chineseName:'标杆3',english:'benchmark3',russian:'benchmark3', info:''},
            {id:4, chineseName:'标杆4',english:'benchmark4',russian:'benchmark4', info:''},
            {id:5, chineseName:'标杆5',english:'benchmark5',russian:'benchmark5', info:''},
            {id:6, chineseName:'标杆6',english:'benchmark6',russian:'benchmark6', info:''},
            {id:7, chineseName:'标杆7',english:'benchmark7',russian:'benchmark7', info:''},
            {id:8, chineseName:'标杆8',english:'benchmark8',russian:'benchmark8', info:''}
          ]       // 标杆描述，文本框编辑
        }
      ],
      tableDoe:0,
      tableScope:null,
      tableForm:{
        // 基础信息
        id: '',             // id，不需要表单编辑
        create_time: null,  // 创建时间，不需要表单编辑
        update_time: null,  // 更新时间，不需要表单编辑
        creator: '',        // 创建人，不需要表单编辑

        // 流程状态
        process_status: '', // 流程状态，不需要表单编辑
        sys_update_user: '', // 更新人，不需要表单编辑
        sys_audit_user: '', // 审核人，不需要表单编辑
        sys_audit_time: null, // 审核时间，不需要表单编辑
        sys_deleted: 0,     // 逻辑删除(0-正常,1-删除)，不需要表单编辑

        // 零部件信息
        part_name: '',      // 零部件名称，选择器编辑
        part_number: '',    // 零部件图号，选择器编辑
        engine_model: [],   // 机型，选择器编辑
        workshop:'',        //车间名称
        lineName:'',        //线体名称
        op:'',              //工序号

        // 失效分类
        failure_classification: '', // 失效分类，选择器编辑
        poka_yoke_level: '',        // 防错等级，选择器编辑
        poka_yoke_type: '',         // 防错类别，选择器编辑
        failure_type: '',           // 失效类别，不需要表单编辑

        // 详细描述
        failure_description: {zh:'',en:'',ru:''},    // 失效描述，文本框编辑
        poka_yoke_process_description: {zh:'',en:'',ru:''}, //防错描述 ，文本框编辑
        is_implement_poka_yoke: '', // 是否实现防错(yes/no)，选择器编辑

        // 对比参考
        related_company_description:[
          {id:1, chineseName:'定兴', englishName:'DingXing', russianName:'DingXing', info: {zh: '', en: '', ru: ''}},
          {id:2, chineseName:'扬中', englishName:'YangZhong', russianName:'YangZhong', info: {zh: '', en: '', ru: ''}},
          {id:3, chineseName:'徐水', englishName:'XuShui', russianName:'XuShui', info: {zh: '', en: '', ru: ''}},
          {id:4, chineseName:'天津', englishName:'TianJing', russianName:'TianJing', info: {zh: '', en: '', ru: ''}},
          {id:5, chineseName:'重庆', englishName:'ChongQing', russianName:'ChongQing', info: {zh: '', en: '', ru: ''}},
          {id:6, chineseName:'江西', englishName:'JiangXi', russianName:'JiangXi', info: {zh: '', en: '', ru: ''}},
          {id:7, chineseName:'大冶', englishName:'DaYan', russianName:'DaYan', info: {zh: '', en: '', ru: ''}},
          {id:8, chineseName:'泰国', englishName:'Thailand', russianName:'Thailand', info: {zh: '', en: '', ru: ''}}
        ], // 兄弟公司描述，文本框编辑
        benchmark_description: [
          {id:1, chineseName:'标杆1',english:'benchmark1',russian:'benchmark1', info: {zh: '', en: '', ru: ''}},
          {id:2, chineseName:'标杆2',english:'benchmark2',russian:'benchmark2', info: {zh: '', en: '', ru: ''}},
          {id:3, chineseName:'标杆3',english:'benchmark3',russian:'benchmark3', info: {zh: '', en: '', ru: ''}},
          {id:4, chineseName:'标杆4',english:'benchmark4',russian:'benchmark4', info: {zh: '', en: '', ru: ''}},
          {id:5, chineseName:'标杆5',english:'benchmark5',russian:'benchmark5', info: {zh: '', en: '', ru: ''}},
          {id:6, chineseName:'标杆6',english:'benchmark6',russian:'benchmark6', info: {zh: '', en: '', ru: ''}},
          {id:7, chineseName:'标杆7',english:'benchmark7',russian:'benchmark7', info: {zh: '', en: '', ru: ''}},
          {id:8, chineseName:'标杆8',english:'benchmark8',russian:'benchmark8', info: {zh: '', en: '', ru: ''}}
        ]       // 标杆描述，文本框编辑
      },
      //失效分类的选择器
      failure_classification_option:[
        {label: '错装/Wrong Installation/Неправильная установка',
        value:'错装/Wrong Installation/Неправильная установка'},
        {
          label: '漏装/Missing Installation/ Пропущенная установка',
          value: '漏装/Missing Installation/ Пропущенная установка'
        },
        {
          label: '装反/Reverse Installation/Установка в обратную сторону',
          value: '装反/Reverse Installation/Установка в обратную сторону'
        },
        {
          label: '装配不到位/Incomplete Installation/Неполная установка',
          value: '装配不到位/Incomplete Installation/Неполная установка'
        },
        {
          label: '漏拧紧/ Incomplete Installation/Неполная установка',
          value: '漏拧紧/ Incomplete Installation/Неполная установка'
        },
        {
          label: '拧紧不合格/Missing Tightening/Несоответствующая затяжка',
          value: '拧紧不合格/Missing Tightening/Несоответствующая затяжка'
        },
      ],
      //防错等级的选择器
      poka_yoke_level_option:[
          {label:'0级-逻辑、设计中规避/Level 0 - Elimination in Logic and Design/Уровень 0 - Исключение в логике и проектировании', value:'0级/Level 0/Уровень 0'},
          {label:'1级-线体自动停止并声音报警/ Level 1 - Line Auto-Stop with Sound Alarm/Уровень 1 - Автостоп линии со звуковым оповещением', value:'1级/Level 1/Уровень 1'},
          {label:'2级-线体发出声音报警，不停止/Level 2 - Sound Alarm without Line Stop/ Уровень 2 - Звуковое оповещение без остановки линии ', value:'2级/Level 2/Уровень 2'},
          {label:'3级-线体发出颜色、光类提示/Level 3 - Visual Indication (Color, Light)/Визуальная индикация (цвет, свет', value:'3级/Level 3/Уровень 3'},
          {label:'4级-靠员工目视、触摸检查/Уровень 4 - Визуальный и тактильный контроль оператором/Level 4 - Operator Visual and Touch Inspection', value:'4级/Level 4/Уровень 4'},
          {label:'5级-无防错/No Poka-Yoke/No Poka-Yoke', value:'5级/Level 5/Уровень 5'},
      ],
      //防错类别的选择器
      poka_yoke_type_option:[
        {label:'1类-精密检测类/Category 1 - Precision Detection/Категория 1 - Высокоточные измерения', value:'1类/Class 1/Категория 1'},
        {label:'2类-拍照探测类/Category 2 - Visual Inspection (Imaging)/Категория 2 - Визуальный контроль (снимки)', value:'2类/Class 2/Категория 2'},
        {label:'3类-对射信号、光电、颜色类/Category 3 - Signals, Photoelectric, Color/ Категория 3 - Сигналы, оптоэлектроника, цвет', value:'3类/Class 3/Категория 3'},
        {label:'4类-人员检查类//Category 4 - Operator Inspection/ Категория 4 - Контроль оператором', value:'4类/Class 4/Категория 4'},
      ],
      //机型的选择器
      engine_type_option:[
        {label:'EB', value:'EB'},
        {label:'EN', value:'EN'},
        {label:'EB05', value:'EB05'},
        {label:'EB35', value:'EB35'},
        {label:'EB75', value:'EB75'},
        {label:'EN19', value:'EN19'},
        {label:'EN38', value:'EN38'},
        {label:'EB/EN全系', value:'EB/EN'},
      ],
      //是否完成的选择器
      is_finish_option:[
        {label:'YES',value:'YES'},
        {label:'NO',value:'NO'},
      ],
      //车间、部门选择器
      workshop_option:[
        {label:'机加/Machining Workshop/Обработки линия', value:'机加/Machining Workshop/Обработки линия'},
        {label:'装配/Assembly Workshop/Сборочная линия', value:'装配/Assembly Workshop/Сборочная линия'},
        {label:'产技/Quality Technology/Tехнологий качества', value:'产技/Quality Technology/Tехнологий качества'},
        {label:'品管/Quality Management/Управления качеством', value:'品管/Quality Management/Управления качеством'},
        {label:'制技/Manufacture Tech/Tехнологии производства', value:'制技/Manufacture Tech/Tехнологии производства'},
        {label:'物流/Logistics Department/Отдел логистики', value:'物流/Logistics Department/Отдел логистики'},
        {label:'设备/Maintenance Utility/Oбслуживания оборудования', value:'设备/Maintenance Utility/Oбслуживания оборудования'},
      ],
      //线体名称选择器：
      line_option:[
        {
          value:'总成线/Assembly line/сборочная линия',
          label:'总成线/Assembly line/сборочная линия'
        },
        {
          value:'缸盖分装线/Cylinder head assembly line/сборочная линия головки блока цилиндров',
          label:'缸盖分装线/Cylinder head assembly line/сборочная линия головки блока цилиндров'
        },
        {
          value:'热试线/Hot test line/Тепловая линия',
          label:'热试线/Hot test line/Тепловая линия'
        }
      ],
      //工序选择器
      op_option:[
        {
          value: 'Hot Test', label: 'Hot Test'},{
          value: 'OP10', label: 'OP10'},{
          value: 'OP20', label: 'OP20'},{
          value: 'OP30', label: 'OP30'},{
          value: 'OP30-1', label: 'OP30-1'},{
          value: 'OP40', label: 'OP40'},{
          value: 'OP50', label: 'OP50'},{
          value: 'OP60', label: 'OP60'},{
          value: 'OP70', label: 'OP70'},{
          value: 'OP80', label: 'OP80'},{
          value: 'OP90', label: 'OP90'},{
          value: 'OP100', label: 'OP100'},{
          value: 'OP105', label: 'OP105'},{
          value: 'OP110', label: 'OP110'},{
          value: 'OP120', label: 'OP120'},{
          value: 'OP130', label: 'OP130'},{
          value: 'OP140', label: 'OP140'},{
          value: 'OP150', label: 'OP150'},{
          value: 'OP155', label: 'OP155'},{
          value: 'OP160', label: 'OP160'},{
          value: 'OP170', label: 'OP170'},{
          value: 'OP180', label: 'OP180'},{
          value: 'OP190', label: 'OP190'},{
          value: 'OP200', label: 'OP200'},{
          value: 'OP210', label: 'OP210'},{
          value: 'OP220', label: 'OP220'},{
          value: 'OP230', label: 'OP230'},{
          value: 'OP240', label: 'OP240'},{
          value: 'OP240-1', label: 'OP240-1'},{
          value: 'OP250', label: 'OP250'},{
          value: 'OP260', label: 'OP260'},{
          value: 'OP270', label: 'OP270'},{
          value: 'OP275', label: 'OP275'},{
          value: 'OP280-1', label: 'OP280-1'},{
          value: 'OP280-2', label: 'OP280-2'},{
          value: 'OP280-3', label: 'OP280-3'},{
          value: 'OP280-4', label: 'OP280-4'},{
          value: 'OP280-5', label: 'OP280-5'},{
          value: 'OP290', label: 'OP290'},{
          value: 'OP300', label: 'OP300'},{
          value: 'OP310', label: 'OP310'},{
          value: 'OP320', label: 'OP320'},{
          value: 'OP330', label: 'OP330'},{
          value: 'OP340', label: 'OP340'},{
          value: 'OP350-1', label: 'OP350-1'},{
          value: 'OP350', label: 'OP350'},{
          value: 'OP360', label: 'OP360'},{
          value: 'OP370', label: 'OP370'},{
          value: 'OP380', label: 'OP380'},{
          value: 'OP390', label: 'OP390'},{
          value: 'OP400', label: 'OP400'},{
          value: 'OP410-1', label: 'OP410-1'},{
          value: 'OP410', label: 'OP410'},{
          value: 'OP420', label: 'OP420'},{
          value: 'OP430', label: 'OP430'},{
          value: 'OP440-1', label: 'OP440-1'},{
          value: 'OP440', label: 'OP440'},{
          value: 'OP450', label: 'OP450'},{
          value: 'OP460', label: 'OP460'},{
          value: 'OP470', label: 'OP470'},{
          value: 'OP480', label: 'OP480'},{
          value: 'OP490', label: 'OP490'},{
          value: 'OP500', label: 'OP500'},{
          value: 'OP510', label: 'OP510'},{
          value: 'HL10', label: 'HL10'},{
          value: 'HL20', label: 'HL20'},{
          value: 'HL30', label: 'HL30'},{
          value: 'GG10', label: 'GG10'},{
          value: 'GG20', label: 'GG20'},{
          value: 'GG30', label: 'GG30'},{
          value: 'GG40', label: 'GG40'},{
          value: 'GG45', label: 'GG45'},{
          value: 'GG50', label: 'GG50'},],
      //弹窗的信息提示变量
      titleUse:'',
      //弹窗的控制打开变量
      //控制编辑分析表的变量
      table_edit_dialog:false,
      //控制编辑兄弟单位的信息弹窗
      related_company_description_dialog:false,
      //控制标杆单位的防错信息
      benchmark_description_dialog:false,
      //控制筛选弹窗的
      filter_dialog:false,
      //零部件的选择器
      part_option:[],
      part_option_data:{},

      //给翻译子组件传递的数据-失效描述
      failure_description:{
        zh:'',
        en:'',
        ru:''
      },
      //给翻译子组件传递的数据-防错描述
      poka_yoke_process_description:{
        zh:'',
        en:'',
        ru:''
      },
      //分页变量，当前页
      page:{
        currentPage:1,
        pageSizes:[20,40,60,80],
        pageSize: 20,
        total:0
      },
      filter:{
        failure_classification:'',
        part_name:'',
        poka_yoke_level:'',
        poka_yoke_type:'',
        engine_type:'',
        is_finish:'',
        workshop:'',
        lineName:'',
        op:'',
        currentPage:1,
        pageSize:20,
      },

    };
  },
  methods:{
    //分页大小改变的时候
    handleSizeChange(val) {
      console.log(`每页 ${val} 条`);
    },
    //当前页改变的时候
    handleCurrentChange(val) {
      console.log(`当前页: ${val}`);
    },
    //失效描述的翻译结果
    failure_description_data(val){
      this.tableForm.failure_description=val
    },
    //防错描述的翻译结果
    poka_yoke_process_description_data(val){
      this.tableForm.poka_yoke_process_description=val
    },
    //编辑防错表单的显示函数
    editTableShow(doe,scope){
      this.tableDoe=doe
      this.tableScope=scope
      if (doe===1){
        //组合表单
        this.tableForm={
          // 基础信息
          id: generateUUIDv4(),             // id，不需要表单编辑
          create_time: null,  // 创建时间，不需要表单编辑
          update_time: null,  // 更新时间，不需要表单编辑
          creator: this.use,        // 创建人，不需要表单编辑

          // 流程状态
          process_status: '', // 流程状态，不需要表单编辑
          sys_update_user: '', // 更新人，不需要表单编辑
          sys_audit_user: '', // 审核人，不需要表单编辑
          sys_audit_time: null, // 审核时间，不需要表单编辑
          sys_deleted: 0,     // 逻辑删除(0-正常,1-删除)，不需要表单编辑

          // 零部件信息
          part_name: '',      // 零部件名称，选择器编辑
          part_number: '',    // 零部件图号，选择器编辑
          engine_model: '',   // 机型，选择器编辑
          workshop:'装配/Assembly Workshop/Сборочная линия',        //车间名称
          lineName:'',        //线体名称
          op:'',              //工序号

          // 失效分类
          failure_classification: '', // 失效分类，选择器编辑
          poka_yoke_level: '',        // 防错等级，选择器编辑
          poka_yoke_type: '',         // 防错类别，选择器编辑
          failure_type: '',           // 失效类别，不需要表单编辑

          // 详细描述
          failure_description: '',    // 失效描述，文本框编辑
          poka_yoke_process_description: '', // ，文本框编辑
          is_implement_poka_yoke: '', // 是否实现防错(yes/no)，选择器编辑

          // 对比参考
          related_company_description: '', // 兄弟公司描述，文本框编辑
          benchmark_description: ''       // 标杆描述，文本框编辑
        }
        //提示表头
        this.titleUse='您正在插入一条防错信息'
        this.table_edit_dialog=true
      }
      else if (doe===2){
        this.tableForm=_.cloneDeep(scope.row)
        this.table_edit_dialog=true
      }
    },
    //编辑防错表单弹窗的表单中的确定函数
    editTableOk(doe,scope){
      if (doe!=='delete'){
        //组合可以向后端传递的数据
        let from=_.cloneDeep(this.tableForm)
        //对零部件名称进行组合，已经带上了供方信息
        let part_name=this.tableForm.part_name.split('/')
        from.part_name=''
        for (let i = 1; i < part_name.length; i++) {
          if (from.part_name===''){
            from.part_name=part_name[i]
          }
          else {
            from.part_name=from.part_name+'/'+part_name[i]
          }
        }
        //对零部件图号进行组合
        from.part_number=part_name[0]
        //对机型进行组合
        from.engine_model=JSON.stringify(this.tableForm.engine_model)
        from.poka_yoke_process_description=JSON.stringify(this.tableForm.poka_yoke_process_description)
        from.failure_description=JSON.stringify(this.tableForm.failure_description)
        from.related_company_description=JSON.stringify(this.tableForm.related_company_description);
        from.benchmark_description=JSON.stringify(this.tableForm.benchmark_description);
        //当时新增一条的时候，向后端插入一条信息
        if (this.tableDoe===1){
          //向后端发送信息，插入一行
          this.$request.post('/insertPokaYokaJobDescription',from).then(result=>{
            if(result.code===401){
              this.$router.push('UserLogin')
              alert("您未登录，请登录")
            }
            else{
              //进行数据赋值
              this.tableData.push(this.tableForm)
              this.table_edit_dialog=false
            }
          })
        }
        if (this.tableDoe===2){
          this.edit_pokaYoke_one_row(this.tableForm).then(()=>{
            this.$message.success("修改成功")
            this.tableData.splice(this.tableScope.$index,1,this.tableForm)
            this.table_edit_dialog=false
          })
        }
      }
      else {
        console.log('到这里了')
        let from=_.cloneDeep(scope.row)
        from.sys_deleted=1
        //对机型进行组合
        from.engine_model=JSON.stringify(scope.row.engine_model)
        from.poka_yoke_process_description=JSON.stringify(scope.row.poka_yoke_process_description)
        from.failure_description=JSON.stringify(scope.row.failure_description)
        from.related_company_description=JSON.stringify(scope.row.related_company_description);
        from.benchmark_description=JSON.stringify(scope.row.benchmark_description);
        this.edit_pokaYoke_one_row(from).then(()=>{
          this.$message.success("删除成功")
          this.tableData.splice(scope.$index,1)
        })
      }
    },
    //显示各单位的防错的编辑窗口
    edit_related_company_description_show(doe,scope){
      this.tableForm=_.cloneDeep(scope.row)
      this.tableScope=scope
      this.tableDoe=doe
      this.related_company_description_dialog=true
    },
    //显示标杆单位的编辑弹窗
    edit_benchmark_description_show(doe,scope){
      this.tableForm=_.cloneDeep(scope.row)
      this.tableScope=scope
      this.tableDoe=doe
      this.benchmark_description_dialog=true
    },
    //编辑兄弟单位的信息的弹窗中点击确定，编辑标杆单位的确定也是这里
    edit_related_company_description(){
      // 保存当前展开状态
      this.expandedKeys = [this.tableScope.row.id];
      //对机型进行组合
      let from=_.cloneDeep(this.tableForm)
      from.engine_model=JSON.stringify(this.tableForm.engine_model)
      from.poka_yoke_process_description=JSON.stringify(this.tableForm.poka_yoke_process_description)
      from.failure_description=JSON.stringify(this.tableForm.failure_description)
      from.related_company_description=JSON.stringify(this.tableForm.related_company_description);
      from.benchmark_description=JSON.stringify(this.tableForm.benchmark_description);
      //编辑一条防错的信息
      this.edit_pokaYoke_one_row(from).then(()=> {
        this.tableData.splice(this.tableScope.$index, 1, this.tableForm)
        this.related_company_description_dialog=false
        this.benchmark_description_dialog=false
      })
    },
    //辅助函数：编辑一条防错信息
    async edit_pokaYoke_one_row(from){
      //向后端发送信息
      let result = await this.$request.post('editPokaYokaJobDescription',from)
      if(result.code===401){
        this.$router.push('UserLogin')
        alert("您未登录，请登录")
      }
      else{
        return result.data
      }
    },
    //弹窗无关闭的函数
    handleClose(done) {
      this.$confirm(
          this.getI18nText('confirmClose'), // 消息内容
          {
            confirmButtonText: this.getI18nText('confirmButton'), // 确认按钮
            cancelButtonText: this.getI18nText('cancelButton'),    // 取消按钮
          }
      )
          .then(() => done())
          .catch(() => {});
    },
    //点击筛选的选择显示
    filterShow(){
      this.filter_dialog=true
    },
    //点击筛选的确定函数
    filterOk(){
      //修改零部件名称、图号的内容
      //组合可以向后端传递的数据
      let filter=_.cloneDeep(this.filter)
      //对零部件名称进行组合，已经带上了供方信息
      let part_name=this.filter.part_name.split('/')
      filter.part_name=''
      for (let i = 1; i < part_name.length; i++) {
        if (filter.part_name===''){
          filter.part_name=part_name[i]
        }
        else {
          filter.part_name=filter.part_name+'/'+part_name[i]
        }
      }
      //对零部件图号进行组合
      filter.part_number=part_name[0]
      console.log(filter)
      // this.filterTableData(filter).then(data=>{
      //   let tableData=this.tableDataToJson(data.data)
      //   this.tableData=[]
      //   this.tableData=tableData
      //   this.page.total=data.total
      // })
    },
    // 通用，弹窗关闭的时候，无意关闭弹窗的函数
    getI18nText(key) {
      const i18nMessages = {
        chinese: {
          confirmClose: '确认关闭？',
          confirmButton: '确定',
          cancelButton: '取消',
        },
        english: {
          confirmClose: 'Sure to close?',
          confirmButton: 'OK',
          cancelButton: 'Cancel',
        },
        russian: {
          confirmClose: 'Уверен в закрытии?',
          confirmButton: 'Подтвердить',
          cancelButton: 'Отмена',
        },
      };
      return i18nMessages[this.languageS]?.[key] ?? i18nMessages.chinese[key];
    },
    //兄弟单位的防错翻译函数
    related_company_translate_data(val,index){
      this.tableForm.related_company_description[index].info=val
    },
    //标杆的防错翻译函数
    benchmark_translate_data(val,index){
      this.tableForm.benchmark_description[index].info=val
    },
    //辅助函数：依据条件筛选数据，并且分页显示
    async filterTableData(filter){
       let result=await this.$request.post('/filterPokaYokJobDescription',filter);
      if(result.code===401){
        this.$router.push('UserLogin')
        alert("您未登录，请登录")
      }
      else{
        return result.data
      }
    },
    //辅助函数，对大表数据进行Json反数序列化
    // 验证JSON格式的核心方法
    tableDataToJson(tableData) {
      for (let i = 0; i < tableData.length; i++) {
        //反序列化机型
        if (tableData[i].engine_model=== '' || tableData[i].engine_model=== null || tableData[i].engine_model===undefined){
          tableData[i].engine_model={zh:'',en:'',ru:''}
        }
        else {
          try {
            // 尝试解析并返回对象
            tableData[i].engine_model = JSON.parse(tableData[i].engine_model);
          } catch (e) {
            // 捕获解析异常
            tableData[i].engine_model={zh:'',en:'',ru:''}
          }
        }
        //反序列化实现描述
        if (tableData[i].failure_description=== '' || tableData[i].failure_description=== null || tableData[i].failure_description===undefined){
          tableData[i].failure_description={zh:'',en:'',ru:''}
        }
        else {
          try {
            // 尝试解析并返回对象
            tableData[i].failure_description = JSON.parse(tableData[i].failure_description);
          } catch (e) {
            // 捕获解析异常
            tableData[i].failure_description={zh:'',en:'',ru:''}
          }
        }
        //反序列化防错描述
        if (tableData[i].poka_yoke_process_description=== '' || tableData[i].poka_yoke_process_description=== null || tableData[i].poka_yoke_process_description===undefined){
          tableData[i].poka_yoke_process_description={zh:'',en:'',ru:''}
        }
        else {
          try {
            // 尝试解析并返回对象
            tableData[i].poka_yoke_process_description = JSON.parse(tableData[i].poka_yoke_process_description);
          } catch (e) {
            // 捕获解析异常
            tableData[i].poka_yoke_process_description={zh:'',en:'',ru:''}
          }
        }
        if (tableData[i].related_company_description ==='' || tableData[i].related_company_description===null || tableData[i].related_company_description===undefined){
          tableData[i].related_company_description=[
            {id:1, chineseName:'定兴', englishName:'DingXing', russianName:'DingXing', info: {zh: '', en: '', ru: ''}},
            {id:2, chineseName:'扬中', englishName:'YangZhong', russianName:'YangZhong', info: {zh: '', en: '', ru: ''}},
            {id:3, chineseName:'徐水', englishName:'XuShui', russianName:'XuShui', info: {zh: '', en: '', ru: ''}},
            {id:4, chineseName:'天津', englishName:'TianJing', russianName:'TianJing', info: {zh: '', en: '', ru: ''}},
            {id:5, chineseName:'重庆', englishName:'ChongQing', russianName:'ChongQing', info: {zh: '', en: '', ru: ''}},
            {id:6, chineseName:'江西', englishName:'JiangXi', russianName:'JiangXi', info: {zh: '', en: '', ru: ''}},
            {id:7, chineseName:'大冶', englishName:'DaYan', russianName:'DaYan', info: {zh: '', en: '', ru: ''}},
            {id:8, chineseName:'泰国', englishName:'Thailand', russianName:'Thailand', info: {zh: '', en: '', ru: ''}}
          ]
        }
        else {
          try {
            // 尝试解析并返回对象
            tableData[i].related_company_description = JSON.parse(tableData[i].related_company_description);
          } catch (e) {
            // 捕获解析异常
            tableData[i].related_company_description=[
              {id:1, chineseName:'定兴', englishName:'DingXing', russianName:'DingXing', info: {zh: '', en: '', ru: ''}},
              {id:2, chineseName:'扬中', englishName:'YangZhong', russianName:'YangZhong', info: {zh: '', en: '', ru: ''}},
              {id:3, chineseName:'徐水', englishName:'XuShui', russianName:'XuShui', info: {zh: '', en: '', ru: ''}},
              {id:4, chineseName:'天津', englishName:'TianJing', russianName:'TianJing', info: {zh: '', en: '', ru: ''}},
              {id:5, chineseName:'重庆', englishName:'ChongQing', russianName:'ChongQing', info: {zh: '', en: '', ru: ''}},
              {id:6, chineseName:'江西', englishName:'JiangXi', russianName:'JiangXi', info: {zh: '', en: '', ru: ''}},
              {id:7, chineseName:'大冶', englishName:'DaYan', russianName:'DaYan', info: {zh: '', en: '', ru: ''}},
              {id:8, chineseName:'泰国', englishName:'Thailand', russianName:'Thailand', info: {zh: '', en: '', ru: ''}}
            ]
          }
        }
        if (tableData[i].benchmark_description=== '' || tableData[i].benchmark_description=== null || tableData[i].benchmark_description===undefined){
          tableData[i].benchmark_description=[
            {id:1, chineseName:'标杆1',english:'benchmark1',russian:'benchmark1', info: {zh: '', en: '', ru: ''}},
            {id:2, chineseName:'标杆2',english:'benchmark2',russian:'benchmark2', info: {zh: '', en: '', ru: ''}},
            {id:3, chineseName:'标杆3',english:'benchmark3',russian:'benchmark3', info: {zh: '', en: '', ru: ''}},
            {id:4, chineseName:'标杆4',english:'benchmark4',russian:'benchmark4', info: {zh: '', en: '', ru: ''}},
            {id:5, chineseName:'标杆5',english:'benchmark5',russian:'benchmark5', info: {zh: '', en: '', ru: ''}},
            {id:6, chineseName:'标杆6',english:'benchmark6',russian:'benchmark6', info: {zh: '', en: '', ru: ''}},
            {id:7, chineseName:'标杆7',english:'benchmark7',russian:'benchmark7', info: {zh: '', en: '', ru: ''}},
            {id:8, chineseName:'标杆8',english:'benchmark8',russian:'benchmark8', info: {zh: '', en: '', ru: ''}}]
        }
        else {
          try {
            // 尝试解析并返回对象
            tableData[i].benchmark_description = JSON.parse(tableData[i].benchmark_description);
          } catch (e) {
            // 捕获解析异常
            tableData[i].benchmark_description=[
              {id:1, chineseName:'标杆1',english:'benchmark1',russian:'benchmark1', info: {zh: '', en: '', ru: ''}},
              {id:2, chineseName:'标杆2',english:'benchmark2',russian:'benchmark2', info: {zh: '', en: '', ru: ''}},
              {id:3, chineseName:'标杆3',english:'benchmark3',russian:'benchmark3', info: {zh: '', en: '', ru: ''}},
              {id:4, chineseName:'标杆4',english:'benchmark4',russian:'benchmark4', info: {zh: '', en: '', ru: ''}},
              {id:5, chineseName:'标杆5',english:'benchmark5',russian:'benchmark5', info: {zh: '', en: '', ru: ''}},
              {id:6, chineseName:'标杆6',english:'benchmark6',russian:'benchmark6', info: {zh: '', en: '', ru: ''}},
              {id:7, chineseName:'标杆7',english:'benchmark7',russian:'benchmark7', info: {zh: '', en: '', ru: ''}},
              {id:8, chineseName:'标杆8',english:'benchmark8',russian:'benchmark8', info: {zh: '', en: '', ru: ''}}]
          }
        }
      }
      return tableData
    },
  },
  mounted() {
    inquiryProductListBaseComponentAll().then(data=>{
      this.part_option_data=data
      if (this.languageS==='chinese'){
        this.part_option=this.part_option_data.chinese
      }
      else if (this.languageS==='english'){
        this.part_option=this.part_option_data.english
      }
      else if (this.languageS==='russian'){
        this.part_option=this.part_option_data.russian
      }
    })
    //查询已经防错分析数据表的内容
    this.filter={
          failure_classification:'',
          part_name:'',
          poka_yoke_level:'',
          poka_yoke_type:'',
          engine_type:'',
          is_finish:'',
          workshop:'',
          lineName:'',
          op:'',
          currentPage:1,
          pageSize:20,
    }
    this.filterTableData(this.filter).then(data=>{
     let tableData=this.tableDataToJson(data.data)
      this.tableData=[]
      this.tableData=tableData
      this.page.total=data.total
    })
  }
};
</script>

<style scoped>

</style>